package com.file;

import java.io.File;
import java.io.IOException;

public class Test_1 {
    public static void main(String[] args) {
//        crate01();
//        create02();
        create03();

    }
    public static   void crate01(){
        String pathname="D:\\javacode\\javacode\\J2024_11_16\\news.txt";
        File file = new File(pathname);

        try {
            file.createNewFile();
            System.out.println("创建成功");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    public static void create02(){
        String filename="news2.txt";
        File file = new File("D:\\javacode\\javacode\\J2024_11_16");
        File file1 = new File(file,filename);
        try {
            file1.createNewFile();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void create03(){
        String pathname="D:\\javacode\\javacode\\J2024_11_16";
        String filename="news3.txt";
        File file = new File(pathname,filename);
        try {
            file.createNewFile();
            System.out.println("创建成功");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

